#include "REG52.H"
sbit DI = P3^4;
sbit STR = P3^5;
sbit SFR = P3^6;
unsigned char arr_col[8] = {0x00,0x7e,0x81,0x81,0x81,0x81,0x7e,0x00};
unsigned char arr_row[8] = {0xff,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xff};
void delay(int x)
{
    while (x--);
}
void hc595_ctrl_col(unsigned char p)
{
    int i = 0;
    for ( i = 0; i < 8; i++)
    {
        DI = (p & 0x80)? 1:0;
        p <<=1;
        SFR = 0;
        delay(1);
        SFR = 1;
        delay(1);
    }
    STR = 0;
    delay(1);
    STR = 1;
    delay(1);
}
void main()
{
    while (1)
    {
        int j = 0;
       for ( j = 0; j < 8; j++)
       {
            P0=arr_row[j];
            hc595_ctrl_col(arr_col[j]);
            delay(100);
            hc595_ctrl_col(0x00);
       }
       
       
        
    }
    
}